#include "QTreeModelItem.h"

QTreeModelItem::QTreeModelItem(QTreeModelItem* pItem, QObject *parent)
: QObject(parent)
{
	_parent = pItem;
}

QTreeModelItem::~QTreeModelItem()
{

}

size_t QTreeModelItem::itemsCount() const
{
	return _vector.size();
}

QTreeModelItem* QTreeModelItem::item(size_t index) const
{
	if( index >= _vector.size() )
	{
		return NULL;
	}
	return _vector.at(index);
}

QTreeModelItem* QTreeModelItem::parentItem() const
{
	return _parent;
}

void QTreeModelItem::addItem(QTreeModelItem* tItem)
{
	_vector.append(tItem);
}

size_t QTreeModelItem::indexOf(QTreeModelItem* tItem) const
{
	return _vector.indexOf(tItem);
}

size_t QTreeModelItem::index()
{
	if(_parent != NULL)
	{
		_parent->indexOf(this);
	}
	return 0;
}